<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/2/20
  Time: 11:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%
    String path = request.getContextPath();
    String basepath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
    <base href="<%=basepath %>"/>
    <meta charset="utf-8"/>
    <title>查找学生信息</title>
</head>
<body>
    <h1>查找单个学生信息</h1>
    <form action="selstudent" method="post">
        请输入要查找学生的序号：<input type="text" name="id" id="id" /><br>
        <input type="submit" name="selbtn" id="selbtn" />
        <input type="reset" name="selrebtn" id="selrebtn"/>
    </form>
   <br>

    <table>
        <tr><th>序号</th><th>姓名</th><th>性别</th><th>年龄</th></tr>
        <tr><td>${student.getId()}</td><td>${student.getName()}</td>
            <td>${student.getSex()}</td><td>${student.getAge()}</td></tr>
    </table>

    <hr>

    <h1>查找多个学生信息</h1>
    <form action="selstudentbysex" method="post">
        请选择性别：
        <select name="sex" id="sex">
            <option value="男">男</option>
            <option value="女">女</option>
        </select>
        <input type="submit" name="selbtnbysex" id="selbtnbysex" />
        <input type="reset" name="selrebtnbysex" id="selrebtnbysex"/>
    </form>


    <table>
        <tr><th>序号</th><th>姓名</th><th>性别</th><th>年龄</th></tr>
        <c:forEach items="${requestScope.studentList}" var="stu" begin="0">
            <tr><td>${stu.getId()}</td><td>${stu.getName()}</td>
                <td>${stu.getSex()}</td><td>${stu.getAge()}</td></tr>
        </c:forEach>
    </table>

    <hr>
    <h1>查找所有学生的情况</h1>
    <a href="getAllStudent">所有学生</a>
    <table>
        <tr><th>序号</th><th>姓名</th><th>性别</th><th>年龄</th></tr>
        <c:forEach items="${requestScope.allStudentList}" var="stu" begin="0">
            <tr><td>${stu.getId()}</td><td>${stu.getName()}</td>
                <td>${stu.getSex()}</td><td>${stu.getAge()}</td></tr>
        </c:forEach>
    </table>




</body>
</html>